﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Web.Http;
using CommandMgr.Entities;
using CommandMgr.ServiceMgr;

namespace CommandMgr.Api.Controllers
{
    public class CommandsController : ApiController
    {
        CommandService service = new CommandService();

        // GET /api/values
        public IEnumerable<Command> Get()
        {
            return service.ListCommands();
        }

        // GET /api/values/5
        public Command Get(string id)
        {
            return service.GetCommand(id);
        }

        // POST /api/values
        public void Post(Command value)
        {
            service.AddCommand(value.Name, value.Descr);
        }

        // PUT /api/values/5
        public void Put(string id, Command value)
        {
            
        }

        // DELETE /api/values/5
        public void Delete(string id)
        {
            service.DeleteCommand(id);
        }
    }
}